/*
 * Conf.h
 *
 *  Created on: Sep 16, 2012
 *      Author: snirgaz
 */

#ifndef CONF_H_
#define CONF_H_

#include <vector>
#include <boost/array.hpp>
#include <boost/tuple/tuple.hpp>
#include "HelpLibs/QmcParameters.h"
#include "HelpLibs/RandomGen.h"
#include <boost/range/algorithm.hpp>
using namespace std;

typedef boost::array<int, 2> BondToSite;

enum OpType {
	EMPTY, DIAG, OFF
};
enum LegState {
	NOT_VISITED, FLIP, DONT_FLIP
};
struct Op {
	//typedef int OpType;
	typedef int OpBond;
	typedef vector<Op> OpVec;
	struct Leg {
		Op *OP;
		Leg* linkedLeg, *bondLeg;
		LegState legState;
	};
	typedef boost::array<Leg, 4> LegArray;
//	Variables
	OpType type;
	OpBond bond;
	LegArray legArray;
	void flip() {
		if (type == DIAG)
			type = OFF;
		else
			type = DIAG;
	}
};

struct SSEConf {
	typedef Op OperatorType;
	typedef int SpinType;
	typedef vector<SpinType> SpinList;
	typedef vector<OperatorType> OperatorList;
	typedef vector<BondToSite> BondsArray;
	SpinList spin;
	OperatorList opList;
	int cutOff;
	int expRank;
	int latSize;
	BondsArray bondsArray;
	double g;
	int L;
	//Functions
	void initSqure(QmcParameters const &qmcParameters, MTGen *eng);
	void adjustCutOff(ofstream &outFile,int i);
	~SSEConf();
};

#endif /* CONF_H_ */
